package com.ciwong.epaper.modules.me.dao;

import android.content.Context;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.ciwong.epaper.R;
import com.ciwong.epaper.application.EApplication;
import com.ciwong.epaper.bean.LoginErrorLog;
import com.ciwong.epaper.bean.LoginInfo;
import com.ciwong.epaper.bean.LoginTokenInfo;
import com.ciwong.epaper.bean.NewRegistUser;
import com.ciwong.epaper.bean.RfTokenInfo;
import com.ciwong.epaper.bean.TermType;
import com.ciwong.epaper.modules.epaper.bean.Answer;
import com.ciwong.epaper.modules.epaper.bean.BasePaging;
import com.ciwong.epaper.modules.epaper.bean.Subject;
import com.ciwong.epaper.modules.epaper.dao.HeadOverrideRequest;
import com.ciwong.epaper.modules.me.bean.BindInfo;
import com.ciwong.epaper.modules.me.bean.BindPhoneInfo;
import com.ciwong.epaper.modules.me.bean.ClassMember;
import com.ciwong.epaper.modules.me.bean.Clazz;
import com.ciwong.epaper.modules.me.bean.DoWorkReport;
import com.ciwong.epaper.modules.me.bean.Duiba;
import com.ciwong.epaper.modules.me.bean.ExperimentService;
import com.ciwong.epaper.modules.me.bean.Issued;
import com.ciwong.epaper.modules.me.bean.NewUserInfo;
import com.ciwong.epaper.modules.me.bean.Service;
import com.ciwong.epaper.modules.me.bean.ServiceInfo;
import com.ciwong.epaper.modules.me.bean.ServicePriceInfo;
import com.ciwong.epaper.modules.me.bean.UserBg;
import com.ciwong.epaper.modules.me.bean.UserInforDetailBean;
import com.ciwong.epaper.modules.me.bean.UserPointMedalsBean;
import com.ciwong.epaper.modules.me.bean.UserPointRankBean;
import com.ciwong.epaper.modules.me.bean.WrongQuestion;
import com.ciwong.epaper.modules.me.bean.WxOrder;
import com.ciwong.epaper.modules.me.bean.WxParent;
import com.ciwong.epaper.util.AESCBCUtil;
import com.ciwong.epaper.util.BaseExtCallBack;
import com.ciwong.epaper.util.DeviceUtil;
import com.ciwong.epaper.util.EConstants;
import com.ciwong.epaper.util.FeedbackUtil;
import com.ciwong.epaper.util.HttpRequest;
import com.ciwong.libs.utils.CWSys;
import com.ciwong.libs.utils.StringUtils;
import com.ciwong.libs.utils.volley.BaseRequest;
import com.ciwong.mobilelib.bean.DetailUserInfo;
import com.ciwong.mobilelib.bean.SchoolDetail;
import com.ciwong.mobilelib.bean.UserInfoBase;
import com.ciwong.mobilelib.i.BaseCallBack;
import com.ciwong.mobilelib.utils.BaseRequestUtil;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.ciwong.epaper.ui.NewLoginActivity.KEY_NO_PWD_TO_LOGIN_CURRENT_BRAND_NAME;

/**
 * 我 相关网络请求
 *
 * @author bin
 * @version ciwong v.1.0 2015/7/23 19:50
 * @since ciwong v.1.0
 */
class MeRequest {
    public static final String TAG_REQUEST_LOGIN = "TAG_REQUEST_LOGIN";

    /**
     * 注册用户
     *
     * @param business_id
     * @param sex
     * @param password
     * @param callBack
     */
    public static void registerUser(String business_id, String mobile, String verify_code, String username, String sex, String password, String confirmPassword,
                                    final BaseCallBack callBack) {
        String key = "0d61cdfebcc4ac902ffce5c6076e2f914d";
        Map<String, String> params = new HashMap<String, String>();
        params.put("business_id", business_id);
        params.put("verify_code", verify_code);
        params.put("realName", URLEncoder.encode(username));
        params.put("sex", sex);
        params.put("mobile", mobile);
        params.put("password", password);
//        params.put("confirmPassword",confirmPassword);
        String code = username + "_" + sex + "_" + password + "_" + key;
        params.put("code", StringUtils.md5(StringUtils.md5(code)));

        params.put(BaseRequest.REQUEST_ACTION, MeAction.ACTION_REGIST_USER);
        params.put(BaseRequest.REQUEST_MODULES, MeAction.class.getName());
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(NewRegistUser.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static void getDuibaLoginurl(final BaseCallBack callBack, String userId) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_USER_GET_DUIBAURL);
        params.put("userId", userId);
        HttpRequest request = new HttpRequest(Request.Method.POST, params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Duiba.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    //测试支付宝接口
    public static void test(
            final BaseCallBack callBack) {
        //String key = "0d61cdfebcc4ac902ffce5c6076e2f914d";
        Map<String, String> params = new HashMap<String, String>();
        //String code = username + "_" + sex + "_" + password + "_" + key;
        //params.put("code", StringUtils.md5(StringUtils.md5(code)));
        params.put(BaseRequest.REQUEST_ACTION, MeAction.Test);
        params.put(BaseRequest.REQUEST_MODULES, MeAction.class.getName());
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(NewRegistUser.class);
        BaseRequestUtil.getInstance().add(request);
    }

    public static void getUserToken(Context context, String userId, String passWord, String uuid, String captchaCode,  final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<>();
        params.put(BaseRequest.REQUEST_ACTION, MeAction.ACTION_GET_USER_TOKEN);
        params.put(BaseRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put("userName", userId);
        params.put("passWord", URLEncoder.encode(passWord));
        params.put("uuid", uuid);
        params.put("captchaCode", captchaCode);
        params.put("captchaCodeType", "1"); //验证码校验方式 0：校验， 1：不校验
        params.put("clientId", EConstants.CLIENT_ID);
        params.put("appVersionId", DeviceUtil.getApplicationId(context));
        params.put("phoneVersion", DeviceUtil.getPhoneVersion());
        params.put("osVersion", DeviceUtil.getOsVersion());
        params.put("brandId", String.valueOf(EApplication.BRAND_ID));


        final LoginErrorLog loginErrorLog = new LoginErrorLog();
        loginErrorLog.setParams("userName:" + userId + "passWord: " + URLEncoder.encode(passWord) + "clientId: " + EConstants.CLIENT_ID + "brandId: " + String.valueOf(EApplication.BRAND_ID));
        HttpRequest request = new HttpRequest(false, params, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                callBack.failed(volleyError);
            }
        }, new BaseRequest.ResponseCallback() {

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    loginErrorLog.setErrorCode(errorCode);
                    loginErrorLog.setErrorMsg(String.valueOf(msg));
                    FeedbackUtil.getInstance().addFeedLockLog(loginErrorLog);
                    callBack.failed(errorCode, msg);
                }
            }

            @Override
            public void error(int errorCode, String msg) {
                loginErrorLog.setErrorCode(errorCode);
                loginErrorLog.setErrorMsg(String.valueOf(msg));
                FeedbackUtil.getInstance().addFeedLockLog(loginErrorLog);
                callBack.failed(errorCode, msg);
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(LoginInfo.class);
        BaseRequestUtil.getInstance().add(request, TAG_REQUEST_LOGIN);
        callBack.setUrl(request.getUrl());

    }

    public static void getIssued(Context context, String content, String userName, String mobile, final BaseExtCallBack callBack) {
        try {
            Map<String, String> params = new HashMap<>();
            params.put(BaseRequest.REQUEST_ACTION, MeAction.ACTION_GET_ISSUED);
            params.put(BaseRequest.REQUEST_MODULES, MeAction.class.getName());
            params.put("brandId", EApplication.BRAND_ID + "");
            if (!"100151".equals(EConstants.CLIENT_ID)) {
                params.put("appName", context.getResources().getString(R.string.app_name));
            } else {
                String brandName = CWSys.getSharedString(KEY_NO_PWD_TO_LOGIN_CURRENT_BRAND_NAME);
                Log.e("getIssued", "brandName: " + brandName);
                if (!TextUtils.isEmpty(brandName)) {
                    params.put("appName", brandName);
                } else {
                    params.put("appName", context.getResources().getString(R.string.app_name));
                }
            }
            params.put("userName", userName);
            params.put("mobile", mobile);
            params.put("appVersionId", DeviceUtil.getVersionName(context));
            params.put("phoneVersion", DeviceUtil.getPhoneVersion());
            params.put("osVersion", DeviceUtil.getOsVersion());
            params.put("content", content);
            HttpRequest request = new HttpRequest(true, 1, params, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError volleyError) {
                    callBack.failed(volleyError);
                }
            }, new BaseRequest.ResponseCallback() {

                @Override
                public void success(Object obj, int resultCode, int errorCode, String msg) {
                    if (resultCode == 0 && errorCode == 0) {
                        callBack.success(obj);
                    } else {
                        callBack.failed(errorCode, msg);
                    }
                }

                @Override
                public void error(int errorCode, String msg) {
                    callBack.failed(errorCode, msg);
                }
            });
            request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
            request.setResponseClazz(Issued.class);
            BaseRequestUtil.getInstance().add(request);
            callBack.setUrl(request.getUrl());
        } catch (Exception e) {
            e.getStackTrace();
        }

    }


    public static void updateToken(String rfToken, final BaseCallBack callBack) {
        HashMap<String, String> params = new HashMap<>();
        params.put("refreshToken", rfToken);
        params.put("publicKey", DeviceUtil.getPublicKey(EConstants.CLIENT_SECRECT));
        params.put("clientId", EConstants.CLIENT_ID);
        String sign = DeviceUtil.getSign(params);
        params.put("sign", sign);
        params.put(BaseRequest.REQUEST_ACTION, MeAction.ACTION_UPDATE_USER_TOKEN);
        params.put(BaseRequest.REQUEST_MODULES, MeAction.class.getName());
        HttpRequest request = new HttpRequest(false, params, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                callBack.failed(volleyError);
            }
        }, new BaseRequest.ResponseCallback() {
            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(RfTokenInfo.class);
        BaseRequestUtil.getInstance().add(request, TAG_REQUEST_LOGIN);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 更具用户手机号获取
     *
     * @param brandId
     * @param mobile
     * @param callBack
     */

    public static void getUserIdByPhone(int brandId, String mobile, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_GET_USER_ID_BY_PHONE);
        params.put("brandId", brandId + "");
        params.put("mobile", mobile);
        Log.d("xinxi", "----你没2---" + mobile);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(NewUserInfo.class);
        BaseRequestUtil.getInstance().add(request, TAG_REQUEST_LOGIN);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 微信通过CODE获取TOKEN
     *
     * @param appid    第三方开发者平台分配的APPID（必选)
     * @param code     第三方登录授权返回的code（必选)
     * @param svrtype  第三方服务的类型,见附表1.2（QQ、weixin）（必选)
     * @param flag     1 返回习网token， 2 返回第三方token，3 两个都返回（不填默认为1）（可选)
     * @param callBack
     */
    public static void getTokenByCode(String appid, String code, String svrtype,
                                      int flag, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("client_secret", EConstants.CLIENT_SECRECT);
        params.put("client_id", EConstants.CLIENT_ID);
        params.put("scope", "all");
        params.put("oauth_version", "2.0");
        params.put("termtype", "" + TermType.TERM_TYPE_ANDROID_PHONE);
        params.put("appid", appid);
        params.put("code", code);
        params.put("svrtype", svrtype);
        if (flag != 0) {
            params.put("flag", String.valueOf(flag));
        }
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_GET_TOKEN_BY_CODE);
        HttpRequest request = new HttpRequest(false, params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(LoginTokenInfo.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * (三)QQ 通过第三方openid获取习网token
     *
     * @param appid         第三方开发者平台分配的APPID（必选)
     * @param openid        授权用户唯一标识（必选)
     * @param access_token  接口调用凭证（必选)
     * @param expires_in    access_token接口调用凭证超时时间，单位（秒）（必选)
     * @param refresh_token （可选)
     * @param svrtype       第三方服务的类型,见附表1.2（QQ、weixin），默认为QQ（可选)
     * @param callBack
     */
    public static void getTokenByOpenId(String appid, String openid,
                                        String access_token, String expires_in, String refresh_token,
                                        String svrtype, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("client_secret", EConstants.CLIENT_SECRECT);
        params.put("client_id", EConstants.CLIENT_ID);
        params.put("scope", "all");
        params.put("oauth_version", "2.0");
        params.put("termtype", "" + TermType.TERM_TYPE_ANDROID_PHONE);
        params.put("appid", appid);
        params.put("openid", openid);
        params.put("access_token", access_token);
        params.put("expires_in", expires_in);
        if (!TextUtils.isEmpty(refresh_token)) {
            params.put("refresh_token", refresh_token);
        }
        if (!TextUtils.isEmpty(svrtype)) {
            params.put("svrtype", svrtype);
        }
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_GET_TOKEN_BY_OPENID);
        HttpRequest request = new HttpRequest(false, params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(LoginTokenInfo.class);
        BaseRequestUtil.getInstance().add(request);
    }

    /**
     * 判断是否绑定手机号
     *
     * @param callBack
     */
    public static void getBindInfo(String business_id, String userId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.GET_BIND_PHONE_INFO);
        params.put("business_id", business_id);
        params.put("userId", userId);
        HttpRequest request = new HttpRequest(params, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                callBack.failed(volleyError);
            }
        }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }

            }
        });
        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(BindInfo.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 获取个人信息
     *
     * @param callBack 请求回调函数
     */
    public static void getUserInfoBase(final BaseCallBack callBack, String userId) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put("userId", userId);
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_GET_USER_INFO_BASE);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                callBack.success(obj);
            }
        });
        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(UserInfoBase.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());


    }


    /**
     * 获取当前登录用户信息，并返回所在学校和班级信息
     *
     * @param callBack
     */
    public static void getDetailUserInfo(final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put("brandId", EApplication.BRAND_ID + "");
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_GET_DETAIL_USER_INFO);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                callBack.success(obj);
            }
        });
        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(DetailUserInfo.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());


    }

    /**
     * 获取用户学校信息
     *
     * @param callBack 请求回调函数
     */
    public static void getSchoolInfo(final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_ONE_SCHOOL);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                callBack.success(obj);
            }
        });
        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<SchoolDetail>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 获取网络我提交的作业列表
     *
     * @param brandId  品牌ID
     * @param isOnline 是否线上作业 1:是 0:否
     * @param page     页码
     * @param pageSize 每页条数
     * @param callBack 回调
     */
    public static void getMyStudyRecord(int brandId, int isOnline, int page,
                                        int pageSize, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_GET_MY_STUDY_RECORD);
        params.put("brandId", brandId + "");
        params.put("isOnline", isOnline + "");
        params.put("page", page + "");
        params.put("pageSize", pageSize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BasePaging<Answer>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 后去听说模考批改结果
     *
     * @param doWorkId 学生做作业ID
     * @param callBack 回调
     */
    public static void getListenWorkCorrect(String doWorkId,
                                            final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_GET_LISTEN_WORK_CORRECT);
        params.put("doworkId", doWorkId);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(String responseStr) {
                try {
                    JSONObject json = new JSONObject(responseStr);
                    int ret = json.getInt(
                            HttpRequest.RESPONSE_DATA_COLUMN_RET);
                    int errcode = json.getInt(
                            HttpRequest.RESPONSE_DATA_COLUMN_ERRCODE);
                    if (ret == 0 && errcode == 0) {
                        String string = json.getString(
                                HttpRequest.RESPONSE_DATA_COLUMN_DATA);
                        callBack.success(string);
                    } else {
                        callBack.failed(errcode, responseStr);
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                    callBack.failed(-1, "");
                }
            }
        });
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 获取不同模块作业提交情况统计
     *
     * @param brandId   品牌ID
     * @param moduleIds 模块ID集合
     * @param callBack  回调
     */
    public static void getDoWorkReport(int brandId, String moduleIds,
                                       final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_DOWORK_REPORT);
        params.put("brandId", brandId + "");
        params.put("moduleIds", moduleIds);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<DoWorkReport>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 习网服务试用
     *
     * @param userId        用户ID
     * @param serviceTypeId 服务类型ID(25-阳光英语报服务)
     * @param versionType   服务版本（1:个人版 2:班级版 3:学校版）
     * @param num           申请试用天数，最多不可以超过15天
     * @param callBack      回调
     *                      <p>
     *                      typeId :默认为：1：移动端；2：web(代理平台)
     */
    public static String openExperiment(long userId, int serviceTypeId,
                                        int versionType, int num, int typeId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_OPEN_EXPERIMENT);
        params.put("userId", userId + "");
        params.put("serviceTypeId", serviceTypeId + "");
        params.put("versionType", versionType + "");
        params.put("Num", num + "");
        params.put("typeId", typeId + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(ExperimentService.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
        return request.getUrl();
    }

    /**
     * 判断是否有家长绑定
     *
     * @param userId   用户ID
     * @param callBack 回调
     */
    public static String getMyParent(long userId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_MYPARENT);
        params.put("userId", userId + "");
        params.put("stateId", "5");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(WxParent.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
        return request.getUrl();
    }

    /**
     * 通知家长购买
     *
     * @param userId      用户ID
     * @param serviceId   服务id
     * @param serviceName 服务名称
     * @param price       服务价格
     * @param unit        服务月数
     * @param callBack    回调
     */
    public static String sendBuyService(long userId, int serviceId, String serviceName, float price, int unit, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_SEN_BUY_SERVICE);
        params.put("userId", userId + "");
        params.put("stateId", "5");
        params.put("serviceId", serviceId + "");
        params.put("serviceName", serviceName + "");
        params.put("price", price + "");
        params.put("unit", unit + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(WxOrder.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
        return request.getUrl();
    }

    /**
     * 获取个人服务信息
     *
     * @param brandId       品牌ID
     * @param userId        用户ID
     * @param serviceTypeId 服务类型ID(25-阳光英语报服务)
     * @param callBack      请求回调函数
     */
    public static String serviceState(int brandId, long userId, int serviceTypeId,
                                      final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_SERVICE_STATE);
        params.put("uIds", userId + "");
        params.put("serviceTypeId", serviceTypeId + "");
        params.put("brandId", brandId + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<ServiceInfo>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

        return request.getUrl();
    }


    /**
     * 获取个人服务信息
     *
     * @param brandId  品牌ID
     * @param callBack 请求回调函数
     */
    public static void getSubjectListByGrade(int brandId, int gradeId, int salesType,
                                             final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_SUBJECT_LIST);
        params.put("gradeId", gradeId + "");
        params.put("brandId", brandId + "");
        params.put("salesType", salesType + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<Subject>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 修改用户信息
     *
     * @param avatar   头像地址
     * @param callBack BaseCallBack
     */
    public static void updateUserInfo(String avatar,
                                      final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
//        if (EApplication.BRAND_ID == 0)
//        {
//            params.put(HttpRequest.REQUEST_ACTION,
//                    WorkBookAction.ACTION_POST_UPDATE_USER_INFO_CIWONG);
//        }
//        else
//
        {
            params.put(HttpRequest.REQUEST_ACTION,
                    MeAction.ACTION_POST_UPDATE_USER_INFO);
        }
        params.put("avatar", avatar);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 修改用户信息
     *
     * @param bgUrl    头像地址
     * @param callBack BaseCallBack
     */
    public static void updateUserBgInfo(String bgUrl, boolean isGet,
                                        final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_POST_UPDATE_USER_BG_INFO);

        params.put("brandId", EApplication.BRAND_ID + "");
        HttpRequest request;
        if (!isGet) {
            params.put("backGround", bgUrl);
            request = new HttpRequest(Request.Method.POST, params,
                    new Response.ErrorListener() {
                        @Override
                        public void onErrorResponse(VolleyError volleyError) {
                            callBack.failed(volleyError);
                        }
                    }, new BaseRequest.ResponseCallback() {
                @Override
                public void error(int errorCode, String msg) {
                    callBack.failed(errorCode, msg);
                }

                @Override
                public void success(Object obj, int resultCode,
                                    int errorCode, String msg) {
                    if (resultCode == 0 && errorCode == 0) {
                        callBack.success(obj);
                    } else {
                        callBack.failed(errorCode, msg);
                    }
                }
            });
        } else {
            request = new HttpRequest(params,
                    new Response.ErrorListener() {
                        @Override
                        public void onErrorResponse(VolleyError volleyError) {
                            callBack.failed(volleyError);
                        }
                    }, new BaseRequest.ResponseCallback() {
                @Override
                public void error(int errorCode, String msg) {
                    callBack.failed(errorCode, msg);
                }

                @Override
                public void success(Object obj, int resultCode,
                                    int errorCode, String msg) {
                    if (resultCode == 0 && errorCode == 0) {
                        callBack.success(obj);
                    } else {
                        callBack.failed(errorCode, msg);
                    }
                }
            });
        }


        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(UserBg.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 根据邀请码加入班级
     *
     * @param brandId   品牌ID
     * @param applyCode 邀请码
     * @param callBack  BaseCallBack
     */
    public static void joinClassByApplyCode(int brandId, String applyCode,
                                            final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("_applyCode", applyCode);
        params.put("brandId", brandId + "");

        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_JOIN_CLASS);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Clazz.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 获取班级列表
     *
     * @param brandId  品牌ID
     * @param userRole 班级角色
     * @param schoolId 学校id
     * @param callBack 回调
     */
    public static void getClassList(int brandId, int userRole, int schoolId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("version", "3");
        params.put("brandId", brandId + "");
        params.put("userRole", userRole + "");
        params.put("schoolId", schoolId + "");
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_CLASS_LIST);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<Clazz>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 获取班级成员
     *
     * @param brandId  品牌ID
     * @param callBack 回调
     */
    public static void getClassMembers(int brandId, long _classId, int flag, int role, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("version", "3");
        params.put("brandId", brandId + "");
        params.put("_classId", _classId + "");
        params.put("flag", flag + "");
        params.put("role", role + "");

        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_CLASS_MEMBERS);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<ClassMember>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 获取班级列表
     *
     * @param brandId  品牌ID
     * @param callBack 回调
     */
    public static void getClassListByTeacherPhoneNum(int brandId, String mobile, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
//        params.put("version", "3");
        params.put("brandId", brandId + "");
        params.put("mobile", mobile + "");
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_CLASS_LIST_BY_MOBILE);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<Clazz>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 加入或更换班级
     *
     * @param brandId  品牌ID
     * @param callBack 回调
     */
    public static void joinClassById(int brandId, int role, long from_Id, long to_Id, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("brandId", brandId + "");
        params.put("from_Id", from_Id + "");
        params.put("to_Id", to_Id + "");
        params.put("role", role + "");

        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_JOIN_CLASS_BY_ID);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseType(Clazz.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 获取班级详情
     *
     * @param brandId  品牌ID
     * @param callBack 回调
     */
    public static void getClassDetail(int brandId, long _cId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
//        params.put("version", "4");
        params.put("brandId", brandId + "");
        params.put("classId", _cId + "");

        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_CLASS_DETAIL);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);

        request.setResponseClazz(Clazz.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 请求发送绑定手机验证码
     *
     * @param
     * @param callBack
     */
    public static void getSmsVerityCode(String business_id, String mobile,  String uuid, String captchaCode, String template_id, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_SMS_VERITY_CODE);
        // params.put("userId", userId);
        final String mobileEncrypt = AESCBCUtil.encrypt(mobile, AESCBCUtil.AESCBC_HEX);
        params.put("business_id", business_id);
        params.put("mobile", mobileEncrypt);
        params.put("uuid", uuid);
        params.put("captchaCode", captchaCode);
        params.put("template_id", template_id);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        //这里简单写一下  借口出来需要改动
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Boolean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 绑定手机号接口
     */
    public static void BindPhone(String userId, String business_id, String mobile, String verify_code, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_BIND_PHONE);
        params.put("userId", userId);
        params.put("business_id", business_id);
        params.put("mobile", mobile);
        params.put("verify_code", verify_code);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(BindPhoneInfo.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 校验验证码是否正确接口
     *
     * @param business_id
     * @param mobile
     * @param callBack
     */
    public static void ValidSmsVerityCode(
            String business_id, String mobile, String verify_code, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_CHECK_SMS_VERITY_CODE);
        final String mobileEncrypt = AESCBCUtil.encrypt(mobile, AESCBCUtil.AESCBC_HEX);
        params.put("business_id", business_id);
        params.put("mobile", mobileEncrypt);
        params.put("verify_code", verify_code);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        //这里简单写一下
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Boolean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 重置密码
     *
     * @param business_id
     * @param mobile
     * @param verify_code
     * @param password
     * @param confirmPassword
     * @param callBack
     */

    public static void reSetPSW(String business_id, String mobile, String verify_code, String password, String confirmPassword, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_RESET_PSW);
        //params.put("userId",userId);
        params.put("business_id", business_id);
        params.put("mobile", mobile);
        params.put("verify_code", verify_code);
        params.put("password", password);
        params.put("confirmPassword", confirmPassword);
        HttpRequest request = new HttpRequest(params, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                callBack.failed(volleyError);
            }
        }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Boolean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 根据邀请码获取班级信息
     *
     * @param brandId   品牌ID
     * @param applyCode 邀请码
     * @param callBack  回调
     */
    public static void getClassInfoByApplyCode(int brandId, String applyCode,
                                               final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_CLASS_INFO);
        params.put("brandId", brandId + "");
        params.put("_cId", "0");
        params.put("applyCode", applyCode);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Clazz.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 获取我的错题
     *
     * @param doWorkId
     * @param callBack
     */
    public static void getMyWrongQuestion(final String doWorkId,
                                          final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("doWorkId", doWorkId);
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_GET_WRONG_QUESTON);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<WrongQuestion>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 验证密码
     *
     * @param pwd      密码
     * @param callBack 回调
     */
    public static void verifyPossword(final String pwd,
                                      final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("pwd", pwd);
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_VERIFY_PWD);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Integer.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 修改密码
     *
     * @param currentPwd 当前密码
     * @param newPwd     新密码
     * @param callBack   回调
     */
    public static String modifyPossword(String currentPwd, String newPwd,
                                        final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("oldPwd", currentPwd);
        params.put("newPwd", newPwd);

        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_MODIFY_PWD);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Integer.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

        return request.getUrl();
    }

    /**
     * 获取电子报品牌信息列表
     *
     * @param brandId   品牌ID
     * @param serviceId 服务ID
     * @param callBack  回调
     */
    public static String getServices(int brandId, int serviceId,
                                     final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_GET_SERVICE_LIST);

        params.put("brandId", brandId + "");
        params.put("serviceId", serviceId + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type type = new TypeToken<List<Service>>() {
        }.getType();
        request.setResponseType(type);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

        return request.getUrl();
    }

    /**
     * 获取服务类型及价格
     *
     * @param sTypeId     服务类型 （25：阳光英语报）
     * @param versionType 服务版本（1：Android 2: IOS 0:其它）
     * @param callBack
     */
    public static void getServicePirce(int sTypeId, int versionType,
                                       final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(BaseRequest.REQUEST_ACTION, MeAction.GET_GET_SERVICE_PIRCE);
        params.put(BaseRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put("sTypeId", String.valueOf(sTypeId));
        params.put("versionType", String.valueOf(versionType));
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<ServicePriceInfo>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * @param brandId      品牌ID
     * @param appVersion   教辅云版本号
     * @param phoneVersion 手机型号
     * @param osVersion    操作系统版本号
     * @param netWorkType  用户网络
     * @param errorType    错误类型
     * @param logDesc      日志描述
     * @param remark       其他备注信息
     * @param callBack
     */
    public static void addFeedbackLog(int brandId, String appVersion, String phoneVersion, String osVersion,
                                      String netWorkType, int errorType, String logDesc, String remark,
                                      final BaseCallBack callBack) {
//        String curDate=getCurrentTime();
        BaseRequest.VerifyInfo verifyInfo = HeadOverrideRequest.getVerifyInfo();
        if (verifyInfo == null) {
            return;
        }
        String clientId = HttpRequest.getVerifyInfo().getClientId();
        if (clientId == null || HeadOverrideRequest.getVerifyInfo() == null) {
            return;
        }
        Map<String, String> params = new HashMap<String, String>();
        params.put("brandId", brandId + "");
        params.put("appVersion", appVersion);
        params.put("phoneVersion", phoneVersion);
        params.put("osVersion", osVersion);
        params.put("netWorkType", netWorkType);
        params.put("errorType", errorType + "");
        params.put("logDesc", logDesc);
        params.put("remark", remark);
        params.put("clientId", clientId);
        params.put("accessToken", HeadOverrideRequest.getVerifyInfo().getAccessToken());
        params.put("client_id", HeadOverrideRequest.getVerifyInfo().getClientId());

        JSONObject jsOb = new JSONObject(params);
        final String jsonStr = jsOb.toString();

        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_ADD_FEEDBACK_LOG);


        HeadOverrideRequest request = new HeadOverrideRequest(Request.Method.POST, params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {

                    if (null != callBack)
                        callBack.success(obj);

                } else {

                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        }) {
            @Override
            public byte[] getBody() throws AuthFailureError {
                return jsonStr.getBytes();
            }
        };


        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Integer.class);
        BaseRequestUtil.getInstance().add(request);

    }


    /**
     * 通知服务器刷新订单状态
     *
     * @param userId
     * @param rechargeNo
     * @param callBack
     */
    public static void toRefPlayState(int userId, String rechargeNo, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                MeAction.ACTION_REF_PLAY_STATE);
        params.put("userId", userId + "");
        params.put("rechargeNo", rechargeNo);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(NewUserInfo.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static String getCurrentTime() {
        Date curDate = new Date(System.currentTimeMillis());
        SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
        return sDateFormat.format(curDate);
    }


    public static void addPoint(@NonNull String userId, @NonNull String userName, @NonNull String integralKey, String objectId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_ADD_POINT);
        params.put("userId", userId);
        params.put("userName", userName);
        params.put("integralKey", integralKey);
        if (!(objectId == null))
            params.put("objectId", objectId);
        HttpRequest request = new HttpRequest(Request.Method.POST, params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(String responseStr) {
                try {
                    JSONObject json = new JSONObject(responseStr);
                    int ret = json.getInt(
                            HttpRequest.RESPONSE_DATA_COLUMN_RET);
                    int errcode = json.getInt(
                            HttpRequest.RESPONSE_DATA_COLUMN_ERRCODE);
                    if (ret == 0 && errcode == 0) {
                        int score = 0;
                        if (json.has(HttpRequest.RESPONSE_DATA_COLUMN_DATA)) {
                            score = json.getInt(HttpRequest.RESPONSE_DATA_COLUMN_DATA);
                        }
                        callBack.success(String.valueOf(score));
                    } else {
                        callBack.failed(errcode, responseStr);
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                    callBack.failed(-1, "");
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_STRING);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }


    /**
     * 清零小红花
     *
     * @param userId
     * @param callBack
     */
    public static void deductdall(int[] userId, final BaseCallBack callBack) {

        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_DEDUCTDALL);

        com.alibaba.fastjson.JSONObject publishWorkBean = new com.alibaba.fastjson.JSONObject();
        publishWorkBean.put("userIds", userId);
        final String commitJson = publishWorkBean.toString();

        HeadOverrideRequest request = new HeadOverrideRequest(Request.Method.POST, params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        }) {
            @Override
            public byte[] getBody() throws AuthFailureError {
                return commitJson.getBytes();
            }
        };
        request.setResponseDataType(com.ciwong.libs.utils.volley.HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        //request.setResponseClazz(String.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 获取服务器添加的积分
     *
     * @param userId
     * @param callBack
     */
    public static void getPoint(@NonNull String userId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_GET_POINT);
        params.put("userId", userId);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(UserPointMedalsBean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static void getUserPointRank(String userId, int brandId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_USER_POINT_RANK);
        params.put("userId", userId);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(UserPointRankBean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static void getUserInforDatile(final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_USER_GET_USERINFOR_DETAIL);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(UserInforDetailBean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 兑吧通用接口
     *
     * @param userId
     * @param redirect
     * @param callBack
     */
    public static String getDuibaLogin(int userId, String redirect,
                                       final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("userId", userId + "");
        if (!TextUtils.isEmpty(redirect)) {
            params.put("redirect", redirect);
        }
        params.put(HttpRequest.REQUEST_MODULES, MeAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, MeAction.ACTION_USER_GET_DUIBA_LOGIN);
        HttpRequest request = new HttpRequest(Request.Method.POST, params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(BaseRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Duiba.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

        return request.getUrl();
    }
}
